precision mediump float;

uniform sampler2D u_samplerDisMap;
uniform sampler2D u_samplerFire;
uniform sampler2D u_samplerFireMask;

uniform float u_fireOffset;

varying vec2 v_uv;

void main()
{
	vec2 texUVOff = texture2D(u_samplerDisMap, vec2(v_uv.x , v_uv.y + u_fireOffset)).rg;
	vec2 texUVDis = vec2(mix(v_uv.x, texUVOff.x, 0.07), mix(v_uv.y, texUVOff.y, 0.07));
	vec4 fireColor = texture2D(u_samplerFire, texUVDis);
	vec4 alphaMask = texture2D(u_samplerFireMask, v_uv);
	
	gl_FragColor = fireColor * vec4(1.0, 1.0, 1.0, alphaMask.r);
}
